package com.yiyuan.weixin.weixinInservice.format;

import com.yiyuan.weixin.model.ReceiveXmlEntity;

import java.util.Date;

/**
 * Created by admin on 2017/3/22.
 */
public class FormatXmlVideo implements FormatXmlService {
    @Override
    public String formatXml(ReceiveXmlEntity receiveXmlEntity) {
        receiveXmlEntity.setMediaId("cnEfAo-ljKP7wSKAW2eesl0PcWr6OPeSum5okPzFRHmL1HWmPymnqhNLcryZAoIt");
        receiveXmlEntity.setTitle("视频消息");
        receiveXmlEntity.setDescription("视频消息的描述");
        // TODO: 2017/3/28 测试用正式注视掉
        StringBuffer sb = new StringBuffer();
        Date date = new Date();
        sb.append("<xml><ToUserName><![CDATA[");
        sb.append(receiveXmlEntity.getFromUserName());
        sb.append("]]></ToUserName><FromUserName><![CDATA[");
        sb.append(receiveXmlEntity.getToUserName());
        sb.append("]]></FromUserName><CreateTime>");
        sb.append(date.getTime());
        sb.append("</CreateTime><MsgType><![CDATA[video]]></MsgType><Video><MediaId><![CDATA[");
        sb.append(receiveXmlEntity.getMediaId());
        sb.append("]]></MediaId><Title><![CDATA[");
        sb.append(receiveXmlEntity.getTitle());
        sb.append("]]></Title><Description><![CDATA[");
        sb.append(receiveXmlEntity.getDescription());
        sb.append("]]></Description></Video></xml>");
        return sb.toString();

    }
}